import dayjs from "dayjs";
import { TIMEINCREMENT } from "../../actions/time/varuable";

const defaultState = {
    time: dayjs().format("YYYY-MM-DD HH:mm:ss"),
};

const reducer = (state = defaultState, action) => {
    switch (action.type) {
        case TIMEINCREMENT:
            return {
                ...state,
                time: dayjs(state.time)
                    .add(1, "second")
                    .format("YYYY-MM-DD HH:mm:ss"),
            };
        default:
            return state;
    }
};

export default reducer;
